﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
using DTO;

namespace DAO
{
    public class DIADIEMTHAMQUAN_THANHPHO_DAO
    {
        #region
        public static List<DIADIEMTHAMQUAN_THANHPHO_DTO> SelectDDTQsByAndMaTuyenDL(int MaTuyenDL)
        {
            List<DIADIEMTHAMQUAN_THANHPHO_DTO> list = new List<DIADIEMTHAMQUAN_THANHPHO_DTO>();
            try
            {
                // Create List Sql Parameter
                List<SqlParameter> sqlParams = new List<SqlParameter>();
                sqlParams.Add(new SqlParameter("@MaTuyenDL", MaTuyenDL));
                DataTable dt = SqlDataAccessHelper.ExecuteQuery("usp_SelectDIA_DIEM_THAM_QUANsByAndMaTuyen", sqlParams);
                foreach (DataRow dr in dt.Rows)
                {
                    DIADIEMTHAMQUAN_THANHPHO_DTO ddtq = new DIADIEMTHAMQUAN_THANHPHO_DTO();
                    ddtq.MaDD = int.Parse(dr["MaDD"].ToString());
                    ddtq.TenDD = dr["TenDD"].ToString();
                    ddtq.GiaVeThamQuan = float.Parse(dr["GiaVeThamQuan"].ToString());
                    ddtq.ChiPhiAnUong = float.Parse(dr["ChiPhiAnUong"].ToString());
                    ddtq.TenTP = dr["TenTP"].ToString();
                    list.Add(ddtq);
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            return list;
        }
        #endregion

    }
}
